Allocation Spaces in Local Memory

The local memory configuration contains multiple allocation spaces (MSpaces). The RTX64 Subsystem, networking components, and each RTSS process and proxy process, has an internal MSpace for internal objects and bookkeeping, and an external MSpace for process allocations.

Memory is allocated from one of the process MSpaces unless the memory is required to stay over process exit, such as memory for IPC objects (like events and semaphores) and cross-process shared memory. Such allocations are made from the Subsystem’s MSpaces.

The diagram below depicts an example of memory allocation for an RTSS process / system process from the Windows Nonpaged Pool to external and internal MSpaces.

In the Windows Nonpaged Pool, black is memory allocated to the Local Pool.

In the Local Pool:

In the Pool Cache:

A number of MSpace default values can be configured in the RTX64 Control Panel or individually through RtssRun and the Task Manager.

A process’ MSpaces are allocated on first request for memory. When you start a real-time process using RtssRun or Task Manager, MSpaces are always allocated at process startup before any code in the process executes. This does not happen when you use RTX64 Native or Managed APIs to start a process, unless you pass the initial size of the process MSpaces to those APIs.

The table below lists the allocation spaces for various types of memory requests:

Memory requests from... Windows memory Local memory
C-Runtime libs (new, malloc, realloc, calloc, etc.) Windows Process ExtMSpace
RtAllocateLocalMemory(Ex) Process ExtMSpace Process ExtMSpace
HeapAlloc/HeapReAlloc Windows Process ExtMSpace
VirtualAlloc Windows Process ExtMSpace
RtAllocateLockedMemory Windows Process ExtMSpace
IPC (RtCreateSharedMemory, etc.) Windows System ExtMSpace
RtCreateProcess Windows Process IntMSpace
RtCreateThread Windows Process IntMSpace
RtCreateEvent, RtCreateSemaphore, … Windows System IntMSpace

Related Topics: